package PasswordJudge;

import java.util.Scanner;

public class PasswordJudge {
    public boolean low(String str){
        if(str.length() < 8){
            return true;
        }else if (str.matches("[0-9]+") || str.matches("[a-zA-Z]+")){
            return true;
        }
        return false;
    }

    public boolean mid(String str){
        boolean letter = false;
        boolean number = false;
        for(int i = 0; i < str.length(); i++){
            char a = str.charAt(i);
            if (Character.isLetter(a)){
                letter = true;
            }if (Character.isDigit(a)){
                number = true;
            }
        }
        if (str.length() >= 8 && letter && number)
            return true;
        return false;
    }

    public boolean hight(String str){
        boolean lower = false;
        boolean upper = false;
        boolean number = false;
        for (int i = 0; i < str.length(); i++){
            char a = str.charAt(i);
            if (Character.isUpperCase(a)){
                upper = true;
            }if(Character.isLowerCase(a)){
                lower = true;
            }if (Character.isDigit(a)){
                number = true;
            }
        }
        if (str.length() >= 8 && lower && upper && number){
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入密码");
        String password = scanner.nextLine();
        PasswordJudge psJ = new PasswordJudge();
        if(psJ.hight(password)){
            System.out.println("高强度密码");
        }else if (psJ.mid(password)){
            System.out.println("中强度密码");
        }else if (psJ.low(password)){
            System.out.println("弱强度密码");
        }
    }

}
